package com.huahua.api.entity.dto.holiday;

import com.huahua.api.entity.pojo.ApiHoliday;
import com.huahua.api.model.LocalData;
import lombok.Data;
import org.springframework.cglib.core.Local;

import java.time.LocalDate;

/**
 * @author LoveHuahua
 * @date 2021年09月05日 16:58
 * @description believe in yourself
 */
@Data
public class HolidayDto {

    /**
     * 日期
     */
    private LocalDate date;


    /**
     * 节假日名称
     */
    private String holidayName;

    /**
     * 节假日描述
     */
    private String holidayDesc;

    /**
     * 节假日类型
     */
    private String holidayType;


    private Integer countryId;


    public ApiHoliday convert() {
        ApiHoliday apiHoliday = new ApiHoliday();
        apiHoliday.setHolidayTime(date);
        apiHoliday.setCountry(countryId);
        apiHoliday.setDay(date.getDayOfMonth());
        apiHoliday.setWeek(date.getDayOfWeek().getValue());
        apiHoliday.setDesc(holidayDesc);
        apiHoliday.setName(holidayName);
        apiHoliday.setYear(date.getYear());
        apiHoliday.setMonth(date.getMonthValue());
        apiHoliday.setType(LocalData.getApiHolidayType(holidayType));

        return apiHoliday;
    }


}
